package com.wx.mall.operate.controller;


import com.wx.mall.common.api.CommonResult;
import com.wx.mall.operate.entity.VSort;
import com.wx.mall.operate.service.impl.RebSortServiceImpl;
import com.wx.mall.operate.service.impl.VSortServiceImpl;
import com.wx.mall.operate.vo.RebSortReqNodeVo;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * VIEW 前端控制器
 * </p>
 *
 * @author j
 * @since 2020-06-09
 */
@RestController
@RequestMapping("/v/sort")
public class VSortController {

    @Autowired
    VSortServiceImpl vSortService;

    @ApiOperation(value = "视图查询已选")
    @PostMapping("/getFindSort")
    public CommonResult<List<RebSortReqNodeVo>> getFindSorts(Long ids){
        List<RebSortReqNodeVo> sortList = vSortService.findSortList(ids);
        return CommonResult.success(sortList);
    }

    @ApiOperation(value = "已选分类默认选中")
    @GetMapping("/getVSort")
    public CommonResult<List<Long>> getVSortList(Long ids){
        List<Long> vSort = vSortService.getVSort(ids);
        return CommonResult.success(vSort);
    }
}

